package com.wms.controller;

import com.wms.bean.ResultBean;
import com.wms.core.R;
import com.wms.entity.StockTakingTaskDetailList;
import com.wms.service.ReviewAdjustmentsDetailListService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.xddf.usermodel.text.TabAlignment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "skh-审核调整单详情(列表)")
public class ReviewAdjustmentsDetailListController {
    @Autowired
    ReviewAdjustmentsDetailListService reviewAdjustmentsDetailListService;

    @GetMapping("/queryReviewAdjustmentsDetailList")
    @ApiOperation("查询审核调整单详情(列表)")
    public ResultBean queryReviewAdjustmentsDetailList(@RequestParam String code){
        StockTakingTaskDetailList stockTakingTaskDetailList = reviewAdjustmentsDetailListService.queryReviewAdjustmentsDetailList(code);
        if (stockTakingTaskDetailList != null){
            return R.success("查询成功",stockTakingTaskDetailList);
        }
        return R.fail("查询失败");
    }

    @PutMapping("/updateTaskAuditStatusByFinishReview")
    @ApiOperation(value = "审核调整单详情(列表)审核完成")
    public ResultBean updateTaskAuditStatusByFinishReview(@RequestParam String code,@RequestParam String auditOpinion,@RequestParam int auditUserId){
        int rs = reviewAdjustmentsDetailListService.updateTaskAuditStatusByFinishReview(code,auditOpinion,auditUserId);
        if (rs>0){
            return R.success("审核完成");
        }
        return R.fail("审核失败");
    }
}
